package com.xxchat.entity.enums;

import lombok.Getter;

/**
 * @author Waicc
 */

@Getter
public enum UserContactApplyStatusEnum {

    PENDING(0, "待处理"),
    AGREE(1, "已同意"),
    REJECT(2, "已拒绝"),
    BLACK(3, "已拉黑");

    private final Integer status;
    private final String desc;

    UserContactApplyStatusEnum(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static UserContactApplyStatusEnum getByStatus(Integer status) {
        for (UserContactApplyStatusEnum e : UserContactApplyStatusEnum.values()) {
            if (e.status.equals(status)) {
                return e;
            }
        }
        return null;
    }

    public static UserContactApplyStatusEnum getByDesc(String desc) {
        try {
            if (desc == null) {
                return null;
            }
            return UserContactApplyStatusEnum.valueOf(desc);
        } catch (Exception e) {
            return null;
        }
    }
}
